package top.ed333.mcplugins.configurableevents;

import org.black_ixx.playerpoints.PlayerPoints;
import org.black_ixx.playerpoints.PlayerPointsAPI;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;

public class PlayerPointsHelper {
    private static PlayerPointsAPI api = null;

    public static void setupPPAPI() {
        if (Bukkit.getPluginManager().isPluginEnabled("PlayerPoints")) {
            api = PlayerPoints.getInstance().getAPI();
        }
    }

    public static void givePoints(Player player, int amt) {
        if (api != null) {
            api.give(player.getUniqueId(), amt);
        }
    }

    public static void takePoints(Player player, int amt) {
        if (api != null) {
            api.take(player.getUniqueId(), amt);
        }
    }

    public static int getPoints(Player player) {
        if (api != null) {
            return api.look(player.getUniqueId());
        }
        return -1;
    }
}
